﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using LexicalAnalyser;
using LexicalAnalyser.Helpers;

namespace WindowsFormsApplication1
{
    public partial class Main_Form : Form
    {
        public Main_Form()
        {
            InitializeComponent();
        }


        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
        }

        private void toolStripSplitButton1_ButtonClick(object sender, EventArgs e)
        {
            richTextBox2.ResetText();
            string sample = @"" + richTextBox1.Text + "";

            var ILexer = new Connector().getLexerInterface();
            List<TokenElement> ListOfTokens = ILexer.Execute_LexicalAnalyser(richTextBox1.Text);

            foreach (var Token in ListOfTokens)
            {
                richTextBox2.Text += string.Format("\n LINE : {0} \t\t TOKEN : {2} \t\t\t TYPE : {1}", Token.LineNo, Token.Token, Token.Id);
            }
            panel2.Enabled = true;
            panel2.Show();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            panel2.Enabled = false;
            panel2.Hide();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            panel2.Enabled = false;
            panel2.Hide();
        }
        public void sendexception(String st)
        {
            richTextBox2.Text = st;
        }
    }
}
